/**
 * 
 */
package cn.hg.solon.youcan.framework.config;

import java.util.function.Supplier;

import org.dromara.hutool.core.convert.Convert;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;

import cn.dev33.satoken.stp.StpUtil;
import cn.hg.solon.youcan.system.listener.EntityInsertListener;

/**
 * @author 胡高
 *
 */
@Configuration
public class FlexEntityListenerConfig {

    @Bean(EntityInsertListener.USER_ID_GETTER)
    public Supplier<Integer> userIdGetter() {
        return () -> {
            return Convert.toInt(StpUtil.getLoginId());
        };
    }

}
